<?php

function everbox_theme_setings_setup() {

	$sections = array();
	$configs = array();

	//General Section
	$sections['general'] = array(
		'title' 	=> __('General', 'everbox'),
		'id'		=> 'general',
		'priority'	=> 1,
		'fields'	=> apply_filters( 'eb_settings_general', array(
			'primary_color' => array(
				'id' => 'primary_color',
				'type' => 'color',
				'sizes'	=> '',
				'title' => __('Primary Color', 'everbox'),
				'desc'	=> ''
			),
			'favicon' => array(
				'id' => 'favicon',
				'type' => 'media',
				'sizes'	=> '',
				'title' => __('Favicon', 'everbox'),
				'desc'	=> __('Site favicon icon.', 'everbox')
			),
			'logo' => array(
				'id' => 'logo',
				'type' => 'media',
				'sizes'	=> '',
				'title' => __('Logo', 'everbox')
			),
			'loop_heading' => array(
				'id'	=> 'loop_heading',
				'type'	=> 'heading',
				'title'	=> __('Loop', 'everbox')
			),
			'category_links' => array(
				'id'	=> 'category_links',
				'type'	=> 'checkbox',
				'title'	=> __('Category', 'everbox'),
				'desc'	=> __('Show post category links?', 'everbox'),
				'std'	=> 'off'
			),
			'excerpt_length' => array(
				'id'	=> 'excerpt_length',
				'type'	=> 'number',
				'title'	=> __('Post Excerpt Length', 'everbox'),
				'desc'	=> __('The default post excerpt length.', 'everbox'),
				'std' 	=> '150',
				'sizes'	=> 'regular'
			),
			'pagination_heading' => array(
				'id'	=> 'pagination_heading',
				'type'	=> 'heading',
				'title'	=> __('Pagination', 'everbox')
			),
			'infinite_pagination' => array(
				'id'	=> 'infinite_pagination',
				'type'	=> 'checkbox',
				'title'	=> __('Infinite Pagination', 'everbox'),
				'desc'	=> __('You must install and active <a href="http://jetpack.me/" target="_blank">jetpack</a> plugin first, otherwise this function does not work.', 'everbox')
			)
		))
	);
	//Mobile Web App
	$sections['web_app'] = array(
		'title'	=> __('Web App', 'everbox'),
		'id'	=> 'web_app',
		'priority'	=> 6,
		'fields' => apply_filters( 'eb_settings_app', array(
			'icon_heading' => array(
				'id' => 'icon_heading',
				'type' => 'heading',
				'title' => __('Icons', 'everbox')
			),
			'iphone_retina_icon120' => array(
				'id' => 'iphone_retina_icon120',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('120x120 iPhone retina icon', 'everbox'),
				'desc' => __('iPhone 5/5c/5s/6 with iOS 7/8 - 60@2x Retina icon.(size must be 120x120)', 'everbox')
			),
			'iphone_retina_icon180' => array(
				'id' => 'iphone_retina_icon180',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('180x180 iPhone retina icon', 'everbox'),
				'desc' => __('iPhone 6 Plus with iOS 8 - 60@3x Retina icon.(size must be 180x180)', 'everbox')
			),
			'iphone_retina_icon114' => array(
				'id' => 'iphone_retina_icon114',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('114x114 iPhone retina icon', 'everbox'),
				'desc' => __('iPhone 4/4s with iOS < 7 - 72@2x Retina icon.(size must be 114x114)', 'everbox')
			),
			'iphone_icon57' => array(
				'id' => 'iphone_icon57',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('57x57 iPhone non-retina icon', 'everbox'),
				'desc' => __('iPhone with iOS < 7 - 1x for non-retian iPhone.(size must be 57x57)', 'everbox')
			),
			'ipad_retina_icon152' => array(
				'id' => 'ipad_retina_icon152',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('152x152 iPad retina icon', 'everbox'),
				'desc' => __(' iPads with iOS 7/8 - 76@2x for iPad 3, 4, Air and Mini.(size must be 152x152)', 'everbox')
			),
			'ipad_retina_icon144' => array(
				'id' => 'ipad_retina_icon144',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('144x144 iPad retina icon', 'everbox'),
				'desc' => __('iPads with iOS < 7 - 72@2x Retina icon.(size must be 144x144)', 'everbox')
			),
			'ipad_icon76' => array(
				'id' => 'ipad_icon76',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('76x76 iPad non-retina', 'everbox'),
				'desc' => __('iPads with iOS 7/8 - for non-retina iPad.(size must be 76x76)', 'everbox')
			),
			'ipad_icon72' => array(
				'id' => 'ipad_icon72',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('72x72 iPad non-retina', 'everbox'),
				'desc' => __('iPads with iOS < 7 - for non-retina iPad.(size must be 72x72)', 'everbox')
			),
			'startup_heading' => array(
				'id' => 'startup_heading',
				'type' => 'heading',
				'title' => __('Startup Image', 'everbox')
			),
			'iphone_startup750' => array(
				'id' => 'iphone_startup750',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('750x1294 iPhone 6 portrait startup image', 'everbox'),
				'desc' => __('iPhone 6 portrait startup image.(size must be 750x1294)', 'everbox')
			),
			'iphone_startup640' => array(
				'id' => 'iphone_startup640',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('640x1096 iPhone 5 portrait startup image', 'everbox'),
				'desc' => __('iPhone 5 portrait startup image.(sizes must be 640x1096)', 'everbox')
			),
			'iphone_startup920' => array(
				'id' => 'iphone_startup920',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('640x920 iPhone < 5 retina startup image', 'everbox'),
				'desc' => __('iPhone < 5 retina startup image.(size must be 640x920)', 'everbox')
			),
			'iphone_startup320' => array(
				'id' => 'iphone_startup320',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('320x640 iPhone < 5 non-retina startup image', 'everbox'),
				'desc' => __('iPhone < 5 non-retina startup image.(size must be 320x640)', 'everbox')
			),
			'iphone_startup1242' => array(
				'id' => 'iphone_startup1242',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('iPhone 6 Plus portrait startup image', 'everbox'),
				'desc' => __('iPhone 6 Plus portrait startup image.(size must be 1242x2148)', 'everbox')
			),
			'iphone_startup1182' => array(
				'id' => 'iphone_startup1182',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('1182x2208 iPhone 6 Plus landscape startup image', 'everbox'),
				'desc' => __('iPhone 6 Plus landscape startup image.(size must be 1182x2208)', 'everbox')
			),
			
			'ipad_startup1536' => array(
				'id' => 'ipad_startup1536',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('1536x2008 iPad retina portrait startup image', 'everbox'),
				'desc' => __('iPad retina portrait startup image.(size must be 1536x2008)', 'everbox')
			),
			'ipad_startup1496' => array(
				'id' => 'ipad_startup1496',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('1496x2048 iPad retina landscape startup image', 'everbox'),
				'desc' => __('iPad retina landscape startup image.(sizes must be 1496x2048)', 'everbox')
			),
			'ipad_startup768' => array(
				'id' => 'ipad_startup768',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('768x1004 iPad non-retina portrait startup image', 'everbox'),
				'desc' => __('iPad non-retina portrait startup image.(size must be 768x1004)', 'everbox')
			),
			'ipad_startup748' => array(
				'id' => 'ipad_startup748',
				'type' => 'media',
				'sizes'	=> 'regular',
				'title' => __('748x1024 iPad non-retina landscape startup image', 'everbox'),
				'desc' => __('iPad non-retina landscape startup image.(size must be 748x1024)', 'everbox')
			)
		))
	);
	//Misc
	$sections['misc'] = array(
		'title'	=> __('Misc', 'everbox'),
		'id'	=> 'misc',
		'priority'	=> 11,
		'fields' => apply_filters( 'eb_settings_misc', array(
			'tracking_heading' => array(
				'id'	=> 'tracking_heading',
				'type'	=> 'heading',
				'title'	=> __('Tracking Code', 'everbox')
			),
			'head_code' => array(
				'id'	=> 'head_code',
				'type'	=> 'textarea',
				'sizes'	=> 'large',
				'title'	=> __('Head Code', 'everbox'),
				'desc'	=> __('Enter scripts or code you would like output to <code>wp_head()</code> which hook executes immediately before the closing <code>&lt;/head&gt;</code> tag in the document source.', 'everbox')
			),
			'body_code' => array(
				'id'	=> 'body_code',
				'type'	=> 'textarea',
				'sizes'	=> 'large',
				'title'	=> __('Body Code', 'everbox'),
				'desc'	=> __('Enter scripts or code you would like output to <code>wp_footer()</code> which hook executes immediately before the closing <code>&lt;/body&gt;</code> tag in the document source.', 'everbox')
			)
		))
	);
	//Extensions
	$sections['extensions'] = array(
		'title'	=> __('Extensions', 'everbox'),
		'id'	=> 'extensions',
		'priority'	=> 16,
		'fields' => apply_filters( 'eb_settings_extensions', array(
			'google_heading' => array(
				'id'	=> 'google_heading',
				'type'	=> 'heading',
				'title'	=> __('Google fonts', 'everbox')
			),
			'disable_google' => array(
				'id' => 'disable_google',
				'type' => 'checkbox',
				'title' => __('Disable Google fonts', 'everbox'),
				'desc'	=> __('Disable enqueuing of Open Sans and other fonts used by WordPress from Google.', 'everbox'),
				'std'	=> 'off'
			),
			'seo_heading' => array(
				'id'	=> 'seo_heading',
				'type'	=> 'heading',
				'title'	=> __('SEO', 'everbox')
			),
			'easy_seo' => array(
				'id'	=> 'easy_seo',
				'type'	=> 'checkbox',
				'title'	=> __('Easy SEO', 'everbox'),
				'desc'	=> __('If you have actived WordPress SEO by Yoast, Easy SEO would be disabled by default.', 'everbox'),
				'std'	=> '1'
			),
			'easy_seo_tag_keywords' => array(
				'id'	=> 'easy_seo_tag_keywords',
				'type'	=> 'checkbox',
				'title'	=> __('Meta Keywords', 'everbox'),
				'desc'	=> __('Use post tags as Meta Keywords.', 'everbox'),
				'std'	=> '1'
			),
			'easy_seo_excerpt_description' => array(
				'id'	=> 'easy_seo_excerpt_description',
				'type'	=> 'checkbox',
				'title'	=> __('Meta Description', 'everbox'),
				'desc'	=> __('Use post excerpt as Meta Description.', 'everbox'),
				'std'	=> '1'
			),
			'easy_seo_front_keywords' => array(
				'id'	=> 'easy_seo_front_keywords',
				'type'	=> 'text',
				'size'  => 'large',
				'title'	=> __('Front Page Meta Keywords', 'everbox'),
				'desc'	=> __('You can enter your own Meta Keywords for front page instead of using post tags.', 'everbox')
			),
			'easy_seo_front_description' => array(
				'id'	=> 'easy_seo_front_description',
				'type'	=> 'textarea',
				'sizes'	=> 'large',
				'title'	=> __('Front Page Description', 'everbox'),
				'desc'	=> __('The description of your site.', 'everbox')
			)
		))
	);
	//About
	$sections['donate'] = array(
		'title'	=> __('Donate', 'everbox'),
		'id'	=> 'donate',
		'type'	=> 'blank',
		'priority'	=> 21,
		'callback' => 'everbox_donate_page',
		'fields' => array()
	);

	$configs = array(
		// This is where your data is stored in the database and also becomes your global variable name.
		'opt_name' 			=> 'everbox_options',
		// Set a different name for your global variable other than the opt_name
		'global_variable'   => '',
		// Specify if the admin menu should appear or not. Options: menu or submenu
		'menu_type' 		=> 'submenu',
		'menu_title' 		=> __('Theme Settings', 'everbox'),
		'page_title' 		=> __('Theme Settings', 'everbox'),
		// For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
		'page_parent'       => 'themes.php',
		// Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.
		'menu_priority'     => null,
		// Specify a custom URL to an icon
		'menu_icon'         => 'dashicons-admin-settings',
		// Permissions needed to access the options panel.
		'page_permissions'  => 'manage_options',
		// Page slug used to denote the panel
		'page_slug'         => '_eb_options',
		// Show the panel pages on the admin bar
		'admin_bar'         => false,
		// On load save the defaults to DB before user clicks save or not
		'save_defaults'		=> true
	);

	if(class_exists('EOF')) {
		$theme_settings_configs = new EOF($configs, $sections);
	}

}
everbox_theme_setings_setup();

function everbox_donate_page() {

	?>
	<p>
		<?php _e('If you like this theme and find it useful, help keep this theme free and actively developed by clicking the donate button. Also, don\'t forget to follow me on Twitter.', 'everbox'); ?>
	</p>
	<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
	<input type="hidden" name="cmd" value="_donations">
	<input type="hidden" name="business" value="mr.moyus@gmail.com">
	<input type="hidden" name="lc" value="US">
	<input type="hidden" name="item_name" value="20Theme">
	<input type="hidden" name="no_note" value="0">
	<input type="hidden" name="currency_code" value="USD">
	<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
	<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
	<img alt="" border="0" src="https://www.paypalobjects.com/zh_XC/i/scr/pixel.gif" width="1" height="1">
	</form>

	<?php
}
?>
